package util

import (
    "strings"

    "cing.io/cing-api/task"
)

func GetTaskFullName(task *task.Task) string {
    if task.Namespace == "" {
        return MergeNamespaceAndName(Default, task.Name)
    }
    return MergeNamespaceAndName(task.Namespace, task.Name)
}

func GetTaskSingerService(task *task.Task) (namespace, name string) {
    index := strings.Index(task.SingerService, "/")
    if index == -1 {
        return task.Namespace, task.SingerService
    } else {
        return SplitNamespaceAndName(task.SingerService)
    }
}
